Skip to content

Add editable templates, layer controls, and image aspect-ratio locking - #372

Open
1eevy wants to merge 7 commits into
nyblnet:mainfrom
1eevy:main
Open

Add editable templates, layer controls, and image aspect-ratio locking#372
1eevy wants to merge 7 commits into
nyblnet:mainfrom
1eevy:main

Conversation

@1eevy

@1eevy 1eevy commented Aug 26, 2026

Copy link
Copy Markdown

This PR was developed with substantial assistance from a large language model as an AI-assisted coding effort. The generated changes were reviewed, built, and validated against the project’s existing checks. It improves slide authoring with editable template pages, safer object layering, per-image aspect-ratio controls, properties-panel scroll preservation, and localization for the new interface elements.

The existing doc.layouts system is extended into a template-page workflow with create, edit, duplicate, delete, save, and cancel actions. Template text boxes remain editable and movable on normal slides, while non-text template elements are rendered as protected background furniture that cannot be selected or reordered. The template manager can be closed with its close button, an outside click, or Escape.

The existing Arrange section continues to provide Bring to front, Bring forward, Send backward, and Send to back controls using the project’s native UI. These operations support normal single-selection and multi-selection workflows while explicitly excluding protected template elements.

Images now have a per-object Keep aspect ratio setting that is enabled by default. When disabled, the image itself can be resized independently in width and height. Re-enabling the setting preserves the image’s current shape and locks its current ratio for subsequent resizing, without restoring any original or historical ratio.

nyblnet added a commit that referenced this pull request Sep 12, 2026
…nk (#447)

doc.assets was append-only. Add images, delete every slide, save — and the
"empty" deck was still 20 MB (#442), because deleting an element removes the
reference and nothing ever removed the bytes. A deck could only ever grow.

The fix lives in slides' own save facade, which now shadows serializeAuto and
serializeFile with wrappers that hand the kernel a COPY of the document with
unreferenced assets removed. The kernel never learns the slides document
shape; the live document is never touched, so undo after a save still brings
an image back and the next save keeps it. Every path that writes a .bento.html
from this app goes through the facade: ⌘S write-back, the download fallback,
the four export copies, and window.bento.serialize().

referencedAssetKeys enumerates every form the format has rather than walking
generically, because the format uses two conventions — `asset:<key>` on
image/media src and media poster, and BARE keys on svg.asset, code's
grammar/theme ids and fonts[].asset — and a walk that knew only one would
delete the other. That enumeration is the cost of this change and the rig pins
each form individually; a count would pass with the wrong six surviving.

blobs (the live-collab offload map) follows assets to the same key set.

Measured, matched pair on the same scenario (one image plus two orphaned
1 MB assets, then delete everything and save):
  main:    3.74 MB / 3 assets  ->  3.74 MB / 3 assets
  patched: 1.75 MB / 1 asset   ->  0.75 MB / 0 assets

test-export-secrets' serializeFile call-site guard is made precise rather than
looser: it now matches a CALL and not a `function serializeFile(` DEFINITION,
which is what the facade wrapper is. Verified by injecting a fresh plain call
into autosave.ts — the guard still fails on it.

Under live collaboration the CRDT syncs assets per key, so pruning the saved
copy cannot lose a peer their asset. The one gap is documented at the
function: a file that pruned K, reopened, then received a peer's op
re-referencing K shows that image broken on that replica only, until re-added.

Prior art: 1eevy's #372 addresses the same bug as one part of a larger
save-time compactor (dedupe, key renaming, data-URI interning) bundled with
three UI features and a kernel hook, and is deferred to a later release. This
is the narrow fix and does not preclude that landing later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant